SET NOCOUNT ON;

-- Drop all tables
declare @sqlcommand varchar(2000)

declare command_cursor CURSOR FOR
select 'DROP TABLE [' + name + ']' SQL
from sys.objects where type = 'U'

OPEN command_cursor

FETCH NEXT FROM command_cursor 
INTO @sqlcommand

WHILE @@FETCH_STATUS = 0
BEGIN

--PRINT @sqlcommand
exec (@sqlcommand)

FETCH NEXT FROM command_cursor
INTO @sqlcommand
END 
CLOSE command_cursor
DEALLOCATE command_cursor
GO


-- Drop full text indexes

-- Text Index for Charges searching

IF EXISTS (SELECT * from sys.fulltext_index_catalog_usages WHERE [object_id] = object_id('Charge'))
	DROP FULLTEXT INDEX ON Charge
GO

IF  EXISTS (SELECT * FROM sysfulltextcatalogs ftc WHERE ftc.name = N'GdnwCat')
	BEGIN
		EXEC sp_fulltext_database 'disable'
		DROP FULLTEXT CATALOG [GdnwCat]
	END
GO


